package gtkwire.widget;

import gtkwire.*;

/**
*A GtkToolItem subclass that displays buttons. NOT TESTED ,DOES THIS WORH AT ALL?
*Documentation for this class is from the gtk+ .c file that this class binds to. See original file for copyrights.
*/
public class GtkToolButton extends GtkToolItem
{
	private Object createFlag = null;
	private String label = null;
	private GtkWidget iconWidget = null;

	public GtkToolButton( String label, GtkWidget iconWidget )
	{
		super();
		widgetType = WT_GtkToolButton;
		this.label = label;
		this.iconWidget = iconWidget;
		createFlag = new Object();
		gtkCreate();
		createFlag = null;
	}

	public GtkToolButton( String name, GladeKey key )
	{
		super( name, key );
		widgetType = WT_GtkToolButton;
	}

	protected String[] getCreateData()
	{
		if( createFlag == null ) return null;
		String[] msg = { label, iconWidget.getName() };
		return msg;
	}

	/**
	*Sets label as the label used for the tool button.
	*/
	public void setlabel( String label )
	{
		app().sendCommand( name, GTKWireCommand.SET_LABEL, label );
	}

	/**
	*If set, an underline in the label property indicates that the 
	*next character should be used for the mnemonic accelerator key in the overflow menu.
	*/
	public void setUseUnderLine( boolean val )
	{
		app().sendCommand( name, GTKWireCommand.SET_USE_UNDERLINE, val );
	}

	/**
	*Sets the button as named stock item. Use a field from GtkStock as input, eg. setStockItem( GtkStock.SAVE_AS ).
	*/
	public void setStockItem( String stock_id)
	{	
		app().sendCommand( name, GTKWireCommand.SET_STOCK, stock_id );
	}

}//end class